package cn.thornbird.orgsync.service.impl;

import cn.thornbird.orgsync.service.ScheduleTaskService;
import cn.thornbird.orgsync.service.TaskService;
import lombok.AllArgsConstructor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class ScheduleTaskServiceImpl implements ScheduleTaskService {

    private final TaskService taskService;

    @Override
    @Scheduled(cron = "0 0/1 * * * ?")
    public void runTaskMinutely() {
        taskService.generateTaskDetails();
        taskService.runTaskDetails();
    }

}
